<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
    <base href="<%=basePath%>">
    <meta charset="utf-8" />
    <title>添加联系人</title>

    <%-- <link href="static/css/bootstrap.min.css" rel="stylesheet" />--%>
    <link href="static/mycss/bootstrap.min.css" rel="stylesheet" />
    <script src='static/js/jquery-1.9.1.min.js'></script>
    <script src='static/js/formvalidJs.js'></script>
    <script type="text/javascript" src="plugins/jquery-validation/jquery.validate.js"></script>
    <script type="text/javascript" src="static/js/jquery.tips.js"></script>
    <script type="text/javascript" src="static/js/layer.js"></script>
    <link rel="stylesheet" href="static/css/layui.css" media="all">
      <style>
        .divcss5{width:200px;}
        .divcss6{width:120px;}
        </style>
        <script type="text/javascript">
            $(top.hangge());
        $(document).ready(function(){
            $("#contStatus").val("0")
            console.log("${userObj}")
            if("${userObj}"!=""||"${userObj}"!=null){
            $("#id").val("${userObj.id}")
            $("#contType").val("${userObj.contType}")
            $("#contShip").val("${userObj.contShip}")
            $("#contUserName").val("${userObj.contUserName}")
            $("#contStatus").val("${userObj.contStatus}")
            $("#contMobile1").val("${userObj.contMobile1}")
            $("#contMobile2").val("${userObj.contMobile2}")
            $("#remark").val("${userObj.remark}")
            }
        });
         function contactAdd(){
             console.log("进入contactAdd")
        	  var issubmit = true;
            if($("#contType").val()=="0"){
                issubmit = false;
                $("#contType").tips({
                    side:3,
                    msg:'请选择联系人类别',
                    bg:'#AE81FF',
                    time:2
                });
            }
           var issubmit1 = $("#commentForm").checkValidy();
               if(issubmit&&issubmit1){
        	    	console.log("提交")
        	     $("#commentForm").submit();
        	    }
        }
    </script>
</head>
<body>
<div class="col-sm-12">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <form name="signUpForm" class="form-horizontal m-t" id="commentForm" novalidate="novalidate" method="post" action="<%=basePath%>/cuijimanage/contactinfoadd.do">
                <input type="hidden" id="userId" name="userId" value="${userId}">
                <input type="hidden" id="id" name="id">
                <br>
                <div class="form-group col-sm-12">
                    <label class="col-sm-4 control-label divcss6">联系人类别<span style="font-family: 'Arial Negreta', 'Arial'; font-weight: 700; color: #FF0000;">*</span>:</label>
                    <div class="col-sm-8" style="display: inline-block;">
                        <select   class="form-control divcss5" name="contType"  id="contType" >
                            <option value="0">请选择联系人类别</option>
                            <option value="1">直系亲属</option>
                            <option value="2">紧急联系人</option>
                            <option value="3">朋友</option>
                            <option value="4">其他</option>
                        </select>
                    </div>
                </div>
                <div class="form-group col-sm-12">
                    <label class="col-sm-4 control-label divcss6">联系人关系<span style="font-family: 'Arial Negreta', 'Arial'; font-weight: 700; color: #FF0000;">*</span>:</label>
                    <div class="col-sm-8" style="display: inline-block;">
                        <select   class="form-control divcss5" name="contShip"  id="contShip" checkIsNull="关系不能为空" >
                            <option value="">请选择联系人关系</option>
                            <c:forEach  var="callship" varStatus="var" items="${linkManShipMap}">
                                <c:if test="${callship.key ne '本人'}">
                                <option value= "${callship.key}">${callship.value}</option>
                                </c:if>
                            </c:forEach>
                            <%--<option value="1">直系亲属</option>
                            <option value="2">紧急联系人</option>
                            <option value="3">朋友</option>
                            <option value="4">其他</option>--%>
                        </select>
                    </div>
                </div>
                <div class="form-group col-sm-12">
                    <label class="col-sm-4 control-label divcss6">联系人姓名<span style="font-family: 'Arial Negreta', 'Arial'; font-weight: 700; color: #FF0000;">*</span>:</label>
                    <div class="col-sm-8" style="display: inline-block;">
                        <input id="contUserName" name="contUserName" type="text" class="form-control divcss5" maxlength ='10' checkName="输入合法姓名" checkIsNull="姓名不能为空"/>
                    </div>
                </div>
                <div class="form-group col-sm-12">
                    <label class="col-sm-4 control-label divcss6"> 状态:</label>
                    <div class="col-sm-8" style="display: inline-block;">
                        <select   class="form-control divcss5" name="contStatus" id="contStatus">
                            <option value="0">有效</option>
                            <option value="1">无效</option>
                        </select>
                    </div>
                </div>
                <div class="form-group col-sm-12">
                    <label class="col-sm-4 control-label divcss6">手机号码1<span style="font-family: 'Arial Negreta', 'Arial'; font-weight: 700; color: #FF0000;">*</span>:</label>
                    <div class="col-sm-8" style="display: inline-block;">
                        <input id="contMobile1" name="contMobile1" type="text" class="form-control divcss5"  maxlength ='11' checkIsNull="不能为空" checkPhone="请输入合法手机号"/>
                    </div>
                </div>
                <div class="form-group col-sm-12">
                    <label class="col-sm-4 control-label divcss6">手机号码2:</label>
                    <div class="col-sm-8" style="display: inline-block;">
                        <input id="contMobile2" name="contMobile2" type="text" class="form-control divcss5"   checkPhone="请输入合法手机号" maxlength ='11'/>
                    </div>
                </div>
                <div class="form-group col-sm-12">
                    <label class="col-sm-4 control-label divcss6 "style="top: -65px";>备注:</label>
                    <div class="col-sm-8" style="display: inline-block;">
                                     <textarea rows="6"  class="form-control divcss5" id="remark" name="remark"  placeholder="200字以内" maxlength ='200'></textarea>
                    </div>
                </div>
                <div class="form-group col-sm-12" style="margin-top: 30px">
                    <div align="center" class="col-sm-7" >
                        <input type="button" id="tijiao" style="width:200px" class="btn btn-info" onclick="contactAdd();" value="确认"/>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>
